<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>07-键盘事件修饰符</title>
</head>
<body>
  <div id="app">
    <h1>vue的例子</h1>
    <p>{{msg}}</p>
    <input type="text" @keyup.enter="keyupHandler" placeholder="enter修饰符">
    <input type="text" @keyup.13="keyupHandler" placeholder="enter修饰符">
    <input type="text" @keydown.tab="tabHandler" placeholder="tab修饰符">
    <input type="text" @keydown.delete="deleteHandler" placeholder="tab修饰符">
    <input type="text" @keydown.esc="escHandler" placeholder="esc修饰符">
    <input type="text" @keydown.space="spaceHandler" placeholder="space修饰符">
    <input type="text" @keydown.up="upHandler" placeholder="up修饰符">
    <input type="text" @keydown.down="downHandler" placeholder="down修饰符">
    <input type="text" @keydown.left="leftHandler" placeholder="left修饰符">
    <input type="text" @keydown.right="rightHandler" placeholder="right修饰符">
  </div>
  <script src="../js/vue.js"></script>
  <script>
    Vue.config.productionTip = false; // 关闭生产提示
    const vm = new Vue({
      el: '#app',
      data: {
        msg: 'hello'
      },
      methods:{
        keyupHandler(e){
          console.log('keyup被触发了...')
          console.log(e.keyCode)
        },
        tabHandler(){
          console.log('tab按键被触发了...')
        },
        deleteHandler(){
          console.log('删除键触发了...')
          // 往前删  退格键  或删除键
          // 往后删  del键
        },
        escHandler(){
          console.log('esc按键触发了...')
        },
        spaceHandler(){
          console.log('space空格键触发了...')
        },
        upHandler(){
          console.log('up向上键被触发了...')
        },
        downHandler(){
          console.log('down向下键被触发了...')
        },
        leftHandler(){
          console.log('left向左键被触发了...')
        },
        rightHandler(e){
          console.log('right向右键被触发了...')
          console.log(e.keyCode)
        }
      }
    })
  </script>
</body>
</html>